#include <stdio.h>
#include <string.h>
#define N 301


int n;
bool v[N];    
int  len[N];
int  a;
int head;

void init()
{
    head = 0;
    scanf("%d", &n);
    memset(v, false, sizeof(v));
    memset(len, 0, sizeof(len));        
}    

inline void inc(int &st)
{
       st++;
       if (st==n) st=0;    
}    
inline int last(int st)
{
    st--;
    if (st==-1) st=n-1;
    return st;
}    
inline int next(int st)
{
    st++;
    if (st==n) st=0;
    return st;
}    


bool findpos(int st)
{
    int time = a+2;
    int pre = st;
    
    while (time--)
    {
        if (v[st]==false) inc(st);       
        else return false;        
        if (time!=0 && pre == st) return false;
    }    
    if (time==-1) return true;
}    

void opd()
{
    int i, j, k;
    int p = head;
    for (i=0; i<n; ++i)
    {
        if (findpos(p)) break;
        inc(p);
    }    
    if (i==n) 
    {
        printf("No space left, please come back later.\n");
    }
    else
    {
        k = a;
        j = p+1;
        while (k--) 
        {
            v[j] = true;
            inc(j);
        }    
        len[p] = a+2;        
        head = p;
        printf("The launderer gives ticket %d.\n", p);
    }        
        
}    
void opw()
{
    int i, k, st;
    
    printf("The launderer gives back batch %d.\n", a);
    head = a;
    k = len[a];
    st = a;
    while (k--)
    {
        v[st] = false;
        inc(st);
    }   
    k = len[a];
    st = a;
    while (k--)
    {
        if (v[last(st)]==false && v[next(st)]==false) 
                printf("%d is freed.\n", st);
        inc(st);
    }    
    
}    

void deal()
{
    char ss[10], nop;
    scanf("%d", &nop);
    while (nop--)
    {
        scanf("%s%d", ss, &a);
        if (ss[0] == 'D') opd();
        else if (ss[0] == 'W') opw();
    }    
}    
int main()
{
    init();
    deal();
        
    return 0;    
}    
/*
4
10
D 1
D 1
W 2
W 0

1
10
D 1
D 2
D 3

2
10
D 1
D 2
D 3
D 4

3
10
D 1
D 1
D 1
W 0

22
6
D 1
D 3
W 0
D 3
D 11


*/